<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>点击按钮后在页面显示更多字符串</title>
<script>
  function print() {
    var str = "";
    var count = window.parseInt(document.frm.num.value);
    count++;
    for (var c = 0; c < count; c++) {
      str = str + "hello world<br>";
    }
    document.frm.num.value = count;
    var sp = document.getElementById("sp");
    sp.innerHTML = str;
  }
</script>
</head>
<body>
  <input type="button" value="write" onclick="print()">
  <form name="frm">
    <label>
      点击次数
      <input type="text" name="num" value="0" disabled>
    </label>
  </form>
  <span id="sp"></span>
</body>
</html>